package com.fenghongzhang.a18102;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;

@Route(path = "/main2/one")
public class Main2Activity extends AppCompatActivity {


    @Autowired
    String name;

    @Autowired
    int age;


    //自动反序列化
    @Autowired
    User user;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

        //普通写法
//        Intent intent = getIntent();
//        String name = intent.getStringExtra("name");
//        Toast.makeText(this, name, Toast.LENGTH_SHORT).show();

        //ARouter接收方式
        ARouter.getInstance().inject(this);
//        Toast.makeText(this, name, Toast.LENGTH_SHORT).show();
//        Toast.makeText(this, age+"", Toast.LENGTH_SHORT).show();

//        String n = user.getName();
//        Toast.makeText(this, n, Toast.LENGTH_SHORT).show();
    }
}
